trigger update_status_field on Project__c (before insert,after insert,after update,before update) 
{


        if(trigger.isbefore && trigger.isInsert)
        
        {
        
            for(Project__c project: trigger.new)
                {
                
               
                        project.Status__c='New';
                        project.Created_Date__c=System.TODAY();
           
                
                 }
         }
         
         
         if(trigger.isbefore && trigger.isupdate)
         
             {
                 
                 for(project__c project:trigger.new)
                 
                    {
                     
                     if(project.Status__c=='Closed')
                     {
                        project.Closed_Date__c=system.TODAY();
                     }
                     
                    }
                 
             }
             
           
         if(trigger.isafter && trigger.isinsert)
         
             {
             
             
             
             }
    
  }